require.config({
    paths: {echarts: default_t}
});
require(
        ['echarts', 'echarts/chart/line', 'echarts/chart/bar'],
        function (ec) {
            var myChart = ec.init(document.getElementById('main'));
            var myChart2 = ec.init(document.getElementById('main2'));
            var option = {
                title: {text: cat+'销售情况'},
                tooltip: {trigger: 'axis'},
                legend: {data: ["订单量", "金额"]},
                toolbox: {
                    show: true,
                    feature: {magicType: {show: true, type: ['line', 'bar']}, saveAsImage: {show: true}}
                },
                xAxis: [{type: 'category', data: getVat}],
                yAxis: [{type: 'value'}],
                series: [
                    {name: '订单量', type: 'line', data: getBill},
                    {name: '金额', type: 'line', data: getTotal}
                ]
            };

            var option2 = {
                title: {text: '数据总计', subtext: '数据来自网络'},
                tooltip: {trigger: 'axis'},
                legend: {
                    data: ['订单数量', '总计']
                },
                toolbox: {
                    show: true,
                    feature: {
                        dataView: {show: true, readOnly: false}, magicType: {show: true, type: ['line', 'bar']},
                        restore: {show: true}, saveAsImage: {show: true}
                    }
                },
                calculable: true,
                xAxis: [{type: 'value', boundaryGap: [0, 0.01]}],
                yAxis: [{type: 'category', data: ['总计']}],
                series: [
                    {
                        name: '订单数量',
                        type: 'bar',
                        data: [amountBill]
                    },
                    {
                        name: '总计',
                        type: 'bar',
                        data: [amountMon]
                    }
                ]
            };
            myChart.setOption(option);
            myChart2.setOption(option2);
        }
);
